/*
	The MIT License

	Copyright (c) 2010 IFMO/GameDev Studio

	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to deal
	in the Software without restriction, including without limitation the rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in
	all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
// rs.h - 

#pragma once

/*-----------------------------------------------------------------------------
	RS :
-----------------------------------------------------------------------------*/

class ERenderSystem : public IRenderSystem {
	public:
							ERenderSystem		( void );
							~ERenderSystem		( void );
	
		virtual void		Install		( void );
		virtual void		Uninstall			( void );
	
		virtual	bool		BeginFrame			( void );
		virtual void		RenderFrame			( void );
		virtual void		EndFrame			( void );
		
		virtual IPxFRScene	GetFRScene			( void ) { return fr_scene; }
		virtual IPxDVScene	GetDVScene			( void ) { return dv_scene; }
		virtual IPxUIScene	GetUIScene			( void ) { return ui_scene; }

		virtual void		GetScreenSize		( uint &w, uint &h );
		virtual void *		GetWindowHandle		( void );
		
		IPxRSDriver			Driver				( void ) { return driver; }
		
	protected:
		void				ReloadShaders		( void );
		void				DebugShowTextures	( void );
	
		IPxRSDriver		driver;
	
		IPxDVScene		dv_scene;
		IPxFRScene		fr_scene;
		IPxUIScene		ui_scene;
		
		IPxUIFont		syschar;

		IPxVar			rs_gl_driver;
		IPxVar			rs_show_gbuffer;
	public:
		void	InitAPI	( void );
	
		static ERenderSystem	*self;
		static int		reloadShaders	( lua_State *L );
		static int		getScreenSize	( lua_State *L );
		static int		defineShader	( lua_State *L );
		static int		screenshot		( lua_State *L );
	};

